<?php

namespace html\core;

class plugin extends \system\core\pluginmanager
{
	protected $caller;
	
	function __construct($class=NULL)
	{
		if(!isset($class)) return;
//		echo "NS: ".__NAMESPACE__."\n";
//		echo "CL: ".$class."\n";
//		$this->ns = str_replace("\\","/",__NAMESPACE__);
//		$this->ns = __NAMESPACE__;
//		$this->pluginname = $class;
		$plugin = new $class;
		self::$registered[$class] = $plugin;
		$reflect = new \ReflectionObject($plugin);
		$methods = $reflect->getMethods();
		if( $methods ) foreach( $methods as $id => $methodObject )
			{
				if( $methodObject->isPublic() )
				{
					self::$methods[$class][$methodObject->name] = $plugin;
				}
			}
//		print_r($reflect->getMethods());
	}

	public function getCaller()
	{
		return $this->caller;
	}
	public function setCaller($object)
	{
		$this->caller = $object;
	}

	private function getPluginPath()
	{
		return $this->ns.'/plugin/'.$this->pluginname;
	}

}

?>
